package com.cxf.cxfuserone.controller;

import com.cxf.cxfuserone.feign.OrderFeign;
import com.cxf.cxfuserone.feign.StoreFeignClient;
import com.cxf.cxfuserone.repository.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * description: UserOneController <br>
 * date: 2021/10/31 9:33 <br>
 * author: cxf <br>
 * version: 1.0 <br>
 */
@RequestMapping
@RestController
public class UserOneController {


    @Autowired
    private OrderFeign orderFeign;
    @Autowired
    private StoreFeignClient storeFeignClient;


    /**
     * @Title: getOrderInfoFeignDiffName
     * @Description: 调用orderinfo
     * @Author: cxf
     * @DateTime: 2021/10/31 9:39
     * @param id
     * @return com.cxf.cxfuserone.repository.Order
     * @throws
     */
    @GetMapping("/userFeignDiff/{id}")
    public Order getOrderInfoFeignDiffName(@PathVariable("id") String id){
        Order forObject = orderFeign.queryOrderFeign(id);
        System.out.println("FeignDiffName 收到响应信息：...."+forObject);
        return forObject;
    }

    /**
     * @Title: getEchoInfo
     * @Description: 获取store服务
     * @Author: cxf
     * @DateTime: 2021/10/31 9:39
     * @param msg
     * @return java.lang.String
     * @throws
     */
    @GetMapping("/echoMes/{msg}")
    public String getEchoInfoFromUserOne(@PathVariable("msg") String msg){
        String msgInfo = storeFeignClient.echoYourMessageFromUserOne(msg);
        return msgInfo;
    }


}
